package com.linfeng.business.admin.domain.entity;

import cn.hutool.core.map.MapUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.linfeng.business.admin.domain.gateway.SysAdminGateway;
import com.linfeng.business.admin.domain.po.SysAdminPO;
import com.linfeng.business.admin.dto.data.admin.SysAdminDTO;
import com.linfeng.component.datasource.dynamic.config.DataSourceNames;
import com.linfeng.component.mybatisplus.entity.impl.Entity;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Data
@Component
public class SysAdminEntity extends Entity<SysAdminDTO, SysAdminPO, SysAdminGateway> {

    @DS(value = DataSourceNames.SLAVE)
    public SysAdminDTO getByLoginName(String loginName) {

        return getOne(MapUtil.of("loginName", loginName));
    }
}
